<?php

include("global.php");

$pagetitle=" - Administration - News";
$links=" > Administration > News";

include ("header.php");

include ("admin_header.php");

if($userloggedinarray[15]!=="administrator"){
	unset($tplcontent);
   $tplcontent['notice'].="Must be logged in as administrator to use control panel!";
   echo template('notice',$tplcontent);
}else{

 if(!$editinfolocation){
 	
 if(!$configarray[26]){$configarray[26]="http://navarone.f2o.org/info/navboard.txt";}

 if(ini_get("allow_url_fopen")){

 if($infoarray=@file("$configarray[26]")){

  for($n=0;$n<count($infoarray);$n++){
   $tplcontent['news'].="$infoarray[$n]<br>";
  }
  $tplcontent['news'].="<br>";

 }else{
  $tplcontent['news'].="NavBoard was unable to get info or there was no info, double check address below<br>";
 }

 }else{
  $tplcontent['news'].="Info cannot be received on this server because allow_url_fopen is off in php ini!<br>";
 }

 $tplcontent['formheader'].="<form action=\"admin_news.php\" method=post>";
 $tplcontent['formheader'].="<input type=hidden name=\"editinfolocation\" value=\"1\">";

 $tplcontent['newsurl'].="<input type=text name=\"infolocation\" value=\"$configarray[26]\" size=60 class=\"forminput\"><br>";

 $tplcontent['submitbutton'].="<input type=submit name=\"submit\" value=\"Update\" class=\"formbutton\">";

 $tplcontent['formfooter'].="</form>";
 
 echo template('adminnews',$tplcontent);
 }

 if($editinfolocation){
 writedata("$maindatadir/config.php",$infolocation,26);

 unset($tplcontent);
 $tplcontent['notice'].="Info location updated!";
 echo template('notice',$tplcontent);

 }

}
include("admin_footer.php");
 print "<br><br>";
 tableheader1();

 include("footer.php");

?>
